#*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*#
#          Copyright (C) 2011 Regents of the University of Colorado.           #
#                             All Rights Reserved.                             #
#                                                                              #
#    This program is free software: you can redistribute it and/or modify      #
#    it under the terms of the GNU General Public License version 2 as         #
#    published by the Free Software Foundation.                                #
#                                                                              #
#    This program is distributed in the hope that it will be useful,           #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of            #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             #
#    GNU General Public License for more details.                              #
#                                                                              #
#    You should have received a copy of the GNU General Public License         #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     #
#                                                                              #
#           Jack Elston                       Cory Dixon                       #
#           elstonj@colorado.edu              dixonc@colorado.edu              #
#                                                                              #
#*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*#

VPATH = ../shared 

default: tcp-listening-client tcp-client udp-client udp-server

command.o: command.cxx command.h commandStruct.h definedCommands.h

tcp-listening-client: command.o tcp-listening-client.o
tcp-client: command.o tcp-client.o
udp-server: command.o udp-server.o
udp-client: command.o udp-client.o

CXXFLAGS := -W -Wall
CPPFLAGS := -I. -I../shared
LIBS :=

%.o: %.cxx
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@

%: %.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

.PHONY: inetRx
inetRx: tcp-listening-client
	./tcp-listening-client 20.0.0.5 12345

.PHONY: inetTx
inetTx: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/coconue/task_path_TM_NexSTAR1.xml

.PHONY: SAVRx
SAVRx: udp-server
	./udp-server 

.PHONY: SAVTx
SAVTx: udp-client
	./udp-client localhost t

.PHONY: mnr
mnr: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_loop_TM_MNR0.xml

.PHONY: loop
loop: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_loop_TM_NexSTAR1.xml

.PHONY: loiter1
loiter1: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_loiter_TM_NexSTAR1.xml

.PHONY: chain1
chain1: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_chain_NexSTAR1.xml

.PHONY: loop2
loop2: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_loop_TM_NexSTAR2.xml

.PHONY: loiter2
loiter2: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_loiter_TM_NexSTAR2.xml

.PHONY: chain2
chain2: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_chain_NexSTAR2.xml

.PHONY: stack
stack: tcp-client
	./tcp-client localhost 56789 ../../xml/testcases/task_stack.xml

.PHONY: clean
clean:
	rm -f *.o tcp-listening-client tcp-client udp-server udp-client
